import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TicketWriteOffVO, TicketWriteOffForm, TicketWriteOffQuery } from '@/api/primary/ticketWriteOff/types';

/**
 * 查询团购核销记录列表
 * @param query
 * @returns {*}
 */

export const listTicketWriteOff = (query?: TicketWriteOffQuery): AxiosPromise<TicketWriteOffVO[]> => {
  return request({
    url: '/primary/ticketWriteOff/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询团购核销记录详细
 * @param id
 */
export const getTicketWriteOff = (id: string | number): AxiosPromise<TicketWriteOffVO> => {
  return request({
    url: '/primary/ticketWriteOff/' + id,
    method: 'get'
  });
};

/**
 * 新增团购核销记录
 * @param data
 */
export const addTicketWriteOff = (data: TicketWriteOffForm) => {
  return request({
    url: '/primary/ticketWriteOff',
    method: 'post',
    data: data
  });
};

/**
 * 修改团购核销记录
 * @param data
 */
export const updateTicketWriteOff = (data: TicketWriteOffForm) => {
  return request({
    url: '/primary/ticketWriteOff',
    method: 'put',
    data: data
  });
};

/**
 * 删除团购核销记录
 * @param id
 */
export const delTicketWriteOff = (id: string | number | Array<string | number>) => {
  return request({
    url: '/primary/ticketWriteOff/' + id,
    method: 'delete'
  });
};
